{
  "metadata" : {
    "config" : {
      "dependencies" : {
        
      },
      "exclusions" : [
      ],
      "repositories" : [
      ],
      "sparkConfig" : {

      }
    }
  },
  "nbformat" : 4,
  "nbformat_minor" : 0,
  "cells" : [
    {
      "cell_type" : "markdown",
      "execution_count" : 0,
      "metadata" : {
        "language" : "text"
      },
      "language" : "text",
      "source" : [
        "# Case class access in Python\n",
        "\n",
        "\n",
        "Just a little demonstration of accessing Scala case class members in Python. \n",
        "\n",
        "First, we need a  case class:\n",
        "\n",
        "\n"
      ],
      "outputs" : [
      ]
    },
    {
      "cell_type" : "code",
      "execution_count" : 1,
      "metadata" : {
        "cell.metadata.exec_info" : {
          "startTs" : 1572052580836,
          "endTs" : 1572052583111
        },
        "language" : "scala"
      },
      "language" : "scala",
      "source" : [
        "case class Foo(someParam: Int, otherParam: String)\n",
        "val foo = new Foo(1, \"hi\")"
      ],
      "outputs" : [
      ]
    },
    {
      "cell_type" : "markdown",
      "execution_count" : 3,
      "metadata" : {
        "language" : "text"
      },
      "language" : "text",
      "source" : [
        "Recall that Scala case class members are actually getter functions. In Python, we'll need to treat them as such"
      ],
      "outputs" : [
      ]
    },
    {
      "cell_type" : "code",
      "execution_count" : 2,
      "metadata" : {
        "cell.metadata.exec_info" : {
          "startTs" : 1572052676317,
          "endTs" : 1572052676485
        },
        "language" : "python"
      },
      "language" : "python",
      "source" : [
        "someParamInPython = foo.someParam()\n",
        "print(\"someParamInPython is:\", someParamInPython)\n",
        "otherParamInPython = foo.otherParam()\n",
        "print(\"otherParamInPython is:\", otherParamInPython)"
      ],
      "outputs" : [
        {
          "name" : "stdout",
          "text" : [
            "someParamInPython is:",
            " ",
            "1",
            "\n",
            "otherParamInPython is:",
            " ",
            "hi",
            "\n"
          ],
          "output_type" : "stream"
        }
      ]
    },
    {
      "cell_type" : "markdown",
      "execution_count" : 4,
      "metadata" : {
        "language" : "text"
      },
      "language" : "text",
      "source" : [
        "That's it!"
      ],
      "outputs" : [
      ]
    }
  ]
}